home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / emacsfilereq / filereq.elx < prev   
Lisp/Scheme  |  1999-09-13  |  803b  |  35 lines

  1. /* Ask a file name using ReqTools file requester */
  2.  
  3. /* Written by Matti Rintala 1993 (email: bitti@cs.tut.fi) */
  4.  
  5. options results
  6.  
  7. parse arg '''' dirname '''' '''' filename '''' exist prompt
  8.  
  9. if ~show("L","rexxreqtools.library") then
  10.   if ~addlib("rexxreqtools.library", 0, -30, 0) then
  11.     exit
  12.  
  13. prompt2 = prompt
  14.  
  15. /* Loop until we get an appropriate answer (i.e. file exists if needed) */
  16.  
  17. do until (~exist | exists(resname)) 
  18.  
  19.   resname = rtfilerequest(dirname, filename, prompt2)
  20.  
  21.   if rtresult == 0 then
  22.     exist = 0   /* If find was canceled, do not require file ("") to exist */
  23.  
  24.   prompt2 = prompt || " (file must exist!)"  /* Prompt for next time */
  25. end
  26.  
  27. /* Now send to filename to Emacs */
  28. if resname ~= "" then
  29.   '(setq filereq-filename "'resname'")'
  30. else
  31.   '(setq filereq-filename nil)'
  32.  
  33.  
  34.  
  35.